[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+-----------------+########################################################
#+-| SET RELATION TO |----------------------------------------+###############
#| +-----------------+ The SET RELATION TO command inserts or |###############
#| deletes a relation from the relation |###############
#| list for the current or selected alias |###############
#+------------------------------------------------------------+###############
##############################################################################
##############################################################################
#+--| Syntax |----------------------------------------------+#################
#| [!<Alias>] SET RELATION TO [<data type-exp> |#################
#| || RECORD <Long-exp>] INTO <Alias> [ADDITIVE] |#################
#+----------------------------------------------------------+#################
##############################################################################
##############################################################################
########+---| Description |------------------------------------------+########
########| SET RELATION TO establishes a relationship between two or |########
########| more aliases. A parent alias is the current or selected |########
########| alias. A child alias is any other active database alias. |########
########| ---------------------------------------------------------- |########
########| Once a relationship is established, the child's record |########
########| pointer is automatically repositioned through its related |########
########| expression when the record pointer is repositioned in the |########
########| parent alias. More than one relation can be established |########
########| by using the ADDITIVE command. |########
########| ---------------------------------------------------------- |########
########| If the child alias record is not found, then eof() will be |########
########| TRUE. |########
########| ---------------------------------------------------------- |########
########| If SET RELATION TO is specified without an alias, then all |########
########| relationships with the parent are NULL. |########
########| ---------------------------------------------------------- |########
########| ADDITIVE |########
########| |########
########| If ADDITIVE is specified, then the relation is added to |########
########| the relation list for the parent alias. Otherwise, the |########
########| relation list is truncated to include only the specified |########
########| relation. |########
########| ---------------------------------------------------------- |########
########| If an expression is defined, then the parent and child |########
########| alias must be indexed on the same index key. |########
########+------------------------------------------------------------+########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Many physicians work at several hospitals. |#########
#########| * Through a relation, the name, specialty and |#########
#########| * date of the last recurrent training class |#########
#########| * can be printed. |#########
#########| |#########
#########| DBFDEF porter && Porter Hospital |#########
#########| CHAR(20) name |#########
#########| CHAR(20) staff_id |#########
#########| ENDDEF |#########
#########| |#########
#########| DBFDEF denver && Denver Gen. Hosp. |#########
#########| CHAR(20) name |#########
#########| CHAR(20) spclty && Specialty |#########
#########| CHAR(20) offset_num && Offset number |#########
#########| && and floor. |#########
#########| ENDDEF |#########
#########| |#########
#########| DBFDEF st_luke && St. Luke's |#########
#########| CHAR(20) name |#########
#########| DATE rtrain && Date of retraining |#########
#########| ENDDEF |#########
#########| |#########
#########| INDEXDEF |#########
#########| CHAR(20) pname porter->name |#########
#########| CHAR(20) dname denver->name |#########
#########| CHAR(20) sname st_luke->name |#########
#########| ENDDEF |#########
#########| |#########
#########| PROCEDURE force_main |#########
#########| |#########
#########| OPEN "porter.dbf" ALIAS porter INDEX pname |#########
#########| OPEN "denver.dbf" ALIAS denver INDEX dname |#########
#########| OPEN "st_luke.dbf" ALIAS st_luke INDEX sname |#########
#########| |#########
#########| SET RELATION TO denver->spclty INTO denver |#########
#########| SET RELATION TO st_luke->rtrain INTO porter ADDITIVE |#########
#########| |#########
#########| !denver LIST porter->name, denver->spclty, ; |#########
#########| st_luke->rtrain TO PRINT |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Delete all relations for the parent alias cars. |#########
#########| |#########
#########| !cars SET RELATION TO |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * If the child is not indexed, its relation |#########
#########| * can be set to its record number. |#########
#########| |#########
#########| OPEN "disks.dbf" ALIAS d |#########
#########| OPEN "partno.dbf" ALIAS p |#########
#########| |#########
#########| SELECT p |#########
#########| SET RELATION TO RECORD INTO d |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
SET FILTER TO
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson